package com.groupnections.client.groups;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.groupnections.client.Groupnections;

public class GetGroups {

	public GetGroups() {

		final GroupsDatabaseServerCallsAsync databaseServerCalls = GWT
				.create(GroupsDatabaseServerCalls.class);

		databaseServerCalls.getGroups(new AsyncCallback<String>() {

			public void onSuccess(String groups) {

				String[] groupsArray = null;

				if (groups != null) {

					groupsArray = groups.split(",");
				}

				new Groupnections(groupsArray);
			}

			public void onFailure(Throwable caught) {
				// Show the RPC error message to the user

			}

		});

	}

}
